#ifndef RECORDSMANAGER_H
#define RECORDSMANAGER_H

#include <QObject>
#include <QMap>
#include <QFile>
#include <QTextStream>

class RecordsManager : public QObject
{
    Q_OBJECT
public:
    explicit RecordsManager(QObject *parent = nullptr);

    void loadRecords();
    void saveRecords();
    void updateRecord(int difficulty, int seconds);
    QString getBestTime(int difficulty) const;

public slots:
    void clearRecords(); // 添加清除方法


private:
    QMap<int, int> m_records; // key:难度 value:秒数
    const QString m_filePath = "records.dat";


signals:
    void recordUpdated(int difficulty);
};

#endif // RECORDSMANAGER_H
